{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport"
		  content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<title>我的</title>
	{include file="public/script" /}
	<link rel="stylesheet" type="text/css" href="__STATIC__/www/css/font-awesome.min.css"/>
</head>
<body>
	<div class="sectionH  sectionH2 mui-clearfix">
		<header class="mui-bar mui-bar-nav" style="">
			<a class="mui-icon mui-icon-left-nav  mui-pull-left" href="{:url('User/index')}" style="color: #727272;"></a>
			<h1 class="mui-title">消费记录</h1>
			<!--<a class="mui-icon mui-pull-right right1" href="assets-1.html"><img src="images/icon_setting.png"/></a>-->
		</header>
	</div>
	<div class="kong1"></div>
	<div class="lian_news_section11">
		<div class="mui-clearfix">
			<ul>
				<li style="width:50%;" onclick="javascript:location.href='/User/myorder/type/1.html';" {if condition="$type==1"}class="select"{/if} >未评价</li>
				<li style="width:50%;" onclick="javascript:location.href='/User/myorder/type/2.html';" {if condition="$type==2"}class="select"{/if}>已评价</li>
			</ul>
		</div>
	</div>
	<div class="kong1"></div>
	<div class="dingdan_section2 " style="position: absolute;z-index: 2;width: 100%;height: 86%;">
		<div class="container" style="position: absolute;width: 100%;z-index: 1;">
			<div class="dingdan_section2_1 select" style="position: relative;">
				{volist name="list" id="item"}
				<div class="a1">
					<div class="a1_1 mui-clearfix">
						<p class="p1">订单号：{$item.orderid}</p>
						<p class="p2">{$item.create_time|date='Y-m-d H:i',###}</p>
					</div>
					<div class="a1_2">
						<p class="p1">{$item.union_name}</p>
						{if condition="$item.order_type == 3"}
						<p class="p2 mui-clearfix">
							<span class="s1">总额:</span>
							<span class="s2"><span class="s3">¥ {$item.all_money}</span></span>
						</p>
						{/if}
						<p class="p2 mui-clearfix">
							<span class="s1">现金:</span>
							<span class="s2"><span class="s3">¥ {$item.money}</span></span>
						</p>
						{if condition="$item.order_type != 1"}
						<p class="p2 mui-clearfix">
							<span class="s1">H链:</span>
							<span class="s2"><span class="s3">{$item.coin}</span></span>
						</p>
						{/if}
					</div>
					{if condition="$item.is_comment==1 && $item.order_type!=1"}
					<div class="a1_3">

						<p class="p1"><a href="{:url('User/ordercomm',['id'=>$item['id']])}">去评价</a></p>

					</div>
					{/if}
					{if condition="$item.is_comment==2"}
					<div class="a1_3 mui-clearfix">
						<div class="div mui-clearfix">
							<p class="p2">评价</p>
							<p class="p3">
								<?php
								$jishu2 = $item['star'];
								for($ii=1;$ii<=5;$ii++ ){
									if($jishu2>=1){
										echo '<span class="fa fa-star select"></span>';
									}elseif($jishu2>0){
										echo '<span class="fa fa-star-half-o select"></span>';
									}else{
										echo '<span class="fa fa-star-o"></span>';
									}
									$jishu2--;
								}
								?>
							</p>
						</div>
						<p class="p4" style="word-break: break-all;">{$item.content}</p>
					</div>
					{/if}
				</div>
				{/volist}
			</div>

		</div>
	</div>
	
</body>
<script>
    mui.init({
        pullRefresh: {
            container: '.dingdan_section2',
            down: {

            },
            up: {
                auto:false,
                contentrefresh: '正在加载...',
                callback: pullupRefresh
            }
        }

    });

    var count = 1;
    var finish = false;
    function pullupRefresh() {
        setTimeout(function() {
            ++count;
            var type = "{$type}";
            $.ajax({
                type: "POST",
                url: "{:url('User/myorder')}",
                data: {page:count,type:type},
                dataType: "json",
                success: function(data){
                    if(data.result_code==='0000'){
                        var list = data.result_data.list;
                        if(list.length===0){
                            finish=true;
                        }
                        mui('.dingdan_section2').pullRefresh().endPullupToRefresh((finish)); //参数为true代表没有更多数据了。
                        var table = document.body.querySelector('.dingdan_section2_1');
                        if(list.length>0){
                            for(var i=0;i<list.length;i++){
                                var url = '/User/ordercomm/id/'+list[i].id+'.html';

                                var html = '<div class="a1_1 mui-clearfix">' +
												'<p class="p1">订单号：'+list[i].orderid+'</p>' +
												'<p class="p2"> '+DateToTime(list[i].create_time,'Y-m-d H:i')+'</p>' +
											'</div>';
                                html += '<div class="a1_2">';
                                html += '<p class="p1">'+list[i].union_name+'</p>';
                                if(list[i].order_type==3){
								html += '<p class="p2 mui-clearfix">' +
										'<span class="s1">总额:</span>' +
										'<span class="s2"><span class="s3">¥ '+list[i].all_money+'</span></span>' +
										'</p>';
								}
								html += '<p class="p2 mui-clearfix">' +
										'<span class="s1">现金:</span>' +
										'<span class="s2"><span class="s3">¥ '+list[i].money+'</span></span>' +
										'</p>';

                                if(list[i].order_type!=1){
                                html += '<p class="p2 mui-clearfix">' +
										'<span class="s1">H链:</span>' +
										'<span class="s2"><span class="s3">'+list[i].coin+'</span></span>' +
										'</p>';
								}

                                html += '</div>';

                                if(list[i].is_comment == 1 && list[i].order_type != 1){
                                html += '<div class="a1_3"><p class="p1"><a href="'+url+'">去评价</a></p></div>';
								}

								if(list[i].is_comment == 2){
                                var star = parseInt(list[i].star);
                                var star_html = '';

								for(var ii=1;ii<=5;ii++ ){
									if(star>=1){
										star_html += '<span class="fa fa-star select"></span>';
									}else if(star>0){
										star_html += '<span class="fa fa-star-half-o select"></span>';
									}else{
										star_html += '<span class="fa fa-star-o"></span>';
									}
									star--;
								}

								html += '<div class="a1_3 mui-clearfix">' +
										'<div class="div mui-clearfix"><p class="p2">评价</p><p class="p3">'+star_html+'</p></div>' +
										'<p class="p4" style="word-break: break-all;">'+list[i]['content']+'</p>' +
										'</div>';
								}

                                var div = document.createElement('div');

                                div.className='a1';
                                div.innerHTML = html;

                                table.appendChild(div);
                            }
                        }
                    }else if(data.result_code==='1111'){
                        mui.alert('请登录','',function(){
                            window.location.href='/Login/login';
                        });
                    }else{
                        mui.alert(data.result_info);
                    }

                }
            });
        }, 500);
    }
</script>
</html>